// JavaScript Document

function ajaxFunction(){
	
	var ajaxRequest;  // magic variable
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	
	// Receive Data Function 
	ajaxRequest.onreadystatechange = function(){
		
		if(ajaxRequest.readyState == 4){
			var ajaxDisplay = document.getElementById('course_list');
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
		}
		
	}
	
	var cur = document.getElementById('cur').value;
	
	var queryString = "?cur=" + cur;
	ajaxRequest.open("GET", "query.php" + queryString, true);
	ajaxRequest.send(null); 
}

function showhide(id)
	{
	    if (document.getElementById)
	    {
	        obj = document.getElementById(id);
	        if (obj.style.display == "none")    //check if already hidden, if yes make it appear
	             obj.style.display = "";
	        else
	             obj.style.display = "none";    //if already appearing then hide here
	    }
	}